<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateStoreServiceLogsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('store_service_logs', function (Blueprint $table) {
            $table->id()->comment('客服用户对话记录表');
            $table->integer('merchant_id')->index()->comment('商户ID')->index();
            $table->integer('sender_service_id')->index()->comment('发送人id')->index();
            $table->integer('receiver_user_id')->index()->comment('接收人id')->index();
            $table->integer('send_at')->comment('发送时间');
            $table->text('news_content')->comment('消息内容');
            $table->tinyInteger('is_tourist')->default(0)->comment(' 是否是游客 1=游客模式，0=非游客');
            $table->timestamp('time_node')->comment('时间节点');
            $table->tinyInteger('is_read')->default(0)->comment('是否已读（0：否；1：是；）');
            $table->tinyInteger('is_remind')->default(0)->comment('是否提醒过 （0：否；1：是；）');
            $table->string('news_type',20)->default('writtenWords')->comment('消息类型 writtenWords=文字 expression=表情 picture=图片 voice=语音');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('store_service_logs');
    }
}
